<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.wu24.bean.*,com.wu24.service.*,java.math.BigDecimal,java.util.*,java.util.Map.Entry"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>购物车</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/owl.carousel.css">
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="css/responsive.css">
 </head>
<body>
<div class="header-area">
        <div class="container">
            <div class="row">
                <div class="col-md-8">
                    <div class="user-menu">
                        <ul>
                             <li><a href="#"><i class="fa fa-user"></i>欢迎<%=((User)session.getAttribute("user")).getUserName() %>登录</a></li>  
                        </ul>
                    </div>                     
                </div>
            </div>
        </div>
    </div> <!-- End header area -->
    
    <div class="site-branding-area">
        <div class="container">
            <div class="row">
                <div class="col-sm-6">
                    <div class="logo">
                        <h1><a href="index.html"><span>西北大学二手交易市场</span></a></h1>
                    </div>
                </div>
                
              <div class="col-sm-6">
                <p>&nbsp;</p>
                  <p>&nbsp;</p>
                <p>寻你所想 如你所愿
                </p>
              </div>
            </div>
        </div>
    </div> <!-- End site branding area -->
    
    <div class="mainmenu-area">
        <div class="container">
            <div class="row">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div> 
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li><a href="main.jsp">首页</a></li>
                        <li ><a href="shop.jsp">逛一逛</a></li>                   
                        <li class="active"><a href="cart.jsp">购物车</a></li>
                        <li><a href="upload.jsp">上传商品</a></li>
                        
                      
                    </ul>
                </div>  
            </div>
        </div>
    </div> <!-- End mainmenu area -->



    <div class="product-big-title-area">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="product-bit-title text-center">
                        <h2>心动了 那就买吧！</h2>
                    </div>
                </div>
            </div>
        </div>
    </div> <!-- End Page title area -->
    
    
    <div class="single-product-area">
        <div class="zigzag-bottom"></div>
        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <div class="single-sidebar">
                        <h2 class="sidebar-title">寻你所想 找你想要</h2>
                        <form action="type.jsp">
                            <input type="text"  name="key" placeholder="输入你想要的商品">
                            <input type="hidden" name="type" value="7"> 
                            <input type="submit" value="搜索">
                        </form>
                    </div>
                    
                    
                          <div class="single-sidebar">
                        <h2 class="sidebar-title">热门商品</h2>
                     
                       <%
                       List<String>ids=CommentService.getHotGood(3);
					    List<Good>hotGoods=new ArrayList<Good>();
					    for(String id:ids){
					    	hotGoods.add(GoodsService.getGoodById(id));
					    }
					    for(Good good:hotGoods){ 
                       
                       %>                     
                        <div class="thubmnail-recent">
                           <a href="singleProduct.jsp?id=<%=good.getGoodId()%>"> <img src="<%=good.getPhotoPath() %>" class="recent-thumb" alt=""></a>
                            <h2><a href="singleProduct.jsp?id=<%=good.getGoodId()%>"><%=good.getName() %></a></h2>
                            <div class="product-sidebar-price">
                            <ins><%=good.getPrice() %>元</ins></div>                             
                        </div>
                       <%
					    }
                       %>
                    </div>
                    
                    <div class="single-sidebar">
                        <h2 class="sidebar-title">&nbsp;</h2>
                        <ul>
                            <li></li>
                        </ul>
                    </div>
                </div>
                
                
                <div class="col-md-8">
                    <div class="product-content-right">
                      <div class="woocommerce">
                        <form method="post" action="#">
                                <table cellspacing="0" class="shop_table cart">
                                    <thead>
                                        <tr>
                                            <th class="product-remove">序号</th> 
                                            <th class="product-thumbnail">商品图片</th>
                                            <th class="product-name">商品名称</th>
                                            <th class="product-price">单价</th>
                                            <th class="product-quantity">数量</th>
                                            <th class="product-subtotal">总计</th>
                                            <th class="product-subtotal">删除</th>
                                        </tr>
                                    </thead>
                                    <tbody>                            
                                    <%
                                        Trolley trolley=(Trolley)session.getAttribute("trolley");
                                        List<Good>goods=trolley.toArrayList();
                                        Good good;
                                        for(int i=0;i<goods.size();i++){
                                        	good=goods.get(i);
                                    %>
                                        <tr class="cart_item">
                                            <th class="product-number"><%=i+1 %></th>

                                            <td class="product-thumbnail">
                                                <a href="single-product.html"><img width="100" height="90" alt="poster_1_up" class="shop_thumbnail" src=<%=good.getPhotoPath() %>></a>
                                            </td>

                                            <td class="product-name">
                                              <a href="single-product.html"><%=good.getName() %></a> 
                                            </td>

                                            <td class="product-price">
                                                <span class="amount"><%=good.getPrice() %>元</span> 
                                            </td>

                                            <td class="product-quantity">
                                                <div class="quantity buttons_added">
                                                  <p>
                                                    <input type="number" size="4" class="input-text qty text" title="Qty" value="<%=good.getCount() %>" min="0" step="1">
                                                  </p>
                                                </div>
                                            </td>

                                            <td class="product-subtotal">
                                                <span class="amount"><%=good.getCount()*Double.parseDouble(good.getPrice()) %></span> 
                                            </td>
                                          
                                            <td class="product-remove">
                                                <a title="Remove this item" class="remove" href="trolleyHandler?type=delete&id=<%=good.getGoodId() %>">×</a> 
                                            </td>
                                        </tr>
                                      <%
                                        }
                                      %>
                                    
                                        <tr>
                                            <td class="actions" colspan="7">总计：<%=trolley.getTotalPrice() %>元</td>
                                        </tr>
                                    </tbody>
                                </table>
                        </form>
                        </div>                        
                    </div>                    
                </div>
            </div>
        </div>
    </div>

<div class="footer-top-area">
        <div class="zigzag-bottom"></div>
        <div class="container">
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="footer-about-us">
                        <h2>声明<span></span></h2>
                        <p>本网站仅做测试使用，如有侵权，请联系我们。</p>
             
                    </div>
                </div>
                
                <div class="col-md-3 col-sm-6">
                    <div class="footer-menu">
                        <h2 align="center" class="footer-wid-title">如果不满意</h2>
                        <ul><li>
                          <div align="center"><a href="">淘宝</a></div>
                        </li>
                            <li>
                              <div align="center"><a href="">苏宁易购</a></div>
                            </li>
                            <li>
                              <div align="center"><a href="">58同城</a></div>
                            </li>
                            <li>
                              <div align="center"><a href="">转转</a></div>
                            </li>
                            <li>
                              <div align="center"><a href="">唯品会</a></div>
                            </li>
                        </ul>                        
                  </div>
                </div>
                
                <div class="col-md-3 col-sm-6">
                    <div class="footer-menu">
                        <h2 align="center" class="footer-wid-title">请点击这里</h2>
                    <ul>
                            <li>
                              <div align="center"><a href="">淘宝</a></div>
                        </li>
                          <li>
                            <div align="center"><a href="">京东</a></div>
                      </li>
                          <li>
                            <div align="center"><a href="">天猫</a></div>
                      </li>
                          <li>
                            <div align="center">蘑菇街<a href=""></a></div>
                          </li>
                        <li>
                              <div align="center"><a href="">赶集网</a></div>
                        </li>
                      </ul>                        
                    </div>
                </div>
                
                <div class="col-md-3 col-sm-6">
                    <div class="footer-newsletter">
                        <h2 align="center" class="footer-wid-title">或者联系我们</h2>
                      <p>如果你对我们的工作不满意，请输入您的建议</p>
                        <div class="newsletter-form">
                            <input type="email" placeholder="请输入您的建议">
                            <input type="submit" value="提交">
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
  
   
   
  </body>
</html>

<!-- Latest jQuery form server -->
<script src="js/jquery-1.8.3.min.js"></script>
    
    <!-- Bootstrap JS form CDN -->
<script src="js/bootstrap.min.js"></script>
    
    <!-- jQuery sticky menu -->
<script src="js/owl.carousel.min.js"></script>
<script src="js/jquery.sticky.js"></script>
    
    <!-- jQuery easing -->
<script src="js/jquery.easing.1.3.min.js"></script>
    
    <!-- Main Script -->
<script src="js/main.js"></script>
  </body>
</html>